Class: HTML_Template_ITX
Source Location: /HTML_Template_IT-1.1.2/ITX.php
HTML_Template_IT
|
--HTML_Template_ITX
Integrated Template Extension - ITX
Author(s):
Version:
- $Id: ITX.php,v 1.13 2005/10/28 11:00:33 dufuz Exp $
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
HTML_Template_ITX (Constructor) [line 119]
HTML_Template_ITX HTML_Template_ITX(
[
$root = ''])
|
|
Builds some complex regexps and calls the constructor of the parent class. Make sure that you call this constructor if you derive your own template class from this one.
Parameters:
addBlock [line 248]
boolean addBlock(
string
$placeholder, string
$blockname, string
$template)
|
|
Adds a block to the template changing a variable placeholder to a block placeholder. Add means "replace a variable placeholder by a new block". This is different to PHPLibs templates. The function loads a block, creates a handle for it and assigns it to a certain variable placeholder. To to the same with PHPLibs templates you would call set_file() to create the handle and parse() to assign the parsed block to a variable. By this PHPLibs templates assume that you tend to assign a block to more than one one placeholder. To assign a parsed block to more than only the placeholder you specify in this function you have to use a combination of getBlock() and setVariable(). As no updates to cached data is necessary addBlock() and addBlockfile() are rather "cheap" meaning quick operations. The block content must not start with <!-- BEGIN blockname --> and end with <!-- END blockname --> this would cause overhead and produce an error.
Parameters:
addBlockfile [line 332]
void addBlockfile(
string
$placeholder, string
$blockname, string
$filename)
|
|
Adds a block taken from a file to the template changing a variable placeholder to a block placeholder.
Parameters:
blockExists [line 571]
boolean blockExists(
string
$blockname)
|
|
Checks wheter a block exists.
Parameters:
BlockvariableExists [line 607]
boolean BlockvariableExists(
string
$block, string
$variable)
|
|
Checks wheter a block variable exists.
Parameters:
buildFunctionlist [line 615]
void buildFunctionlist(
)
|
|
Builds a functionlist from the template.
deleteFromBlockvariablelist [line 707]
void deleteFromBlockvariablelist(
string
$block, mixed
$variables)
|
|
Deletes one or many variables from the block variable list.
Parameters:
findPlaceholderBlocks [line 762]
array findPlaceholderBlocks(
string
$variable)
|
|
Returns an array of blocknames where the given variable placeholder is used.
Parameters:
getBlocklist [line 553]
Returns a list of blocknames in the template.
getBlockvariables [line 584]
array getBlockvariables(
string
$block)
|
|
Returns a list of variables of a block.
Parameters:
getFunctioncalls [line 430]
array getFunctioncalls(
)
|
|
Returns a list of all function calls in the current template.
getValue [line 657]
void getValue(
$code,
$delimiter)
|
|
Parameters:
init [line 129]
performCallback [line 399]
Checks the list of function calls in the template and calls their callback function.
placeholderExists [line 351]
string placeholderExists(
string
$placeholder, [string
$block = ''])
|
|
Returns the name of the (first) block that contains the specified placeholder.
Parameters:
removeBlockData [line 529]
void removeBlockData(
string
$block)
|
|
Recursively removes all data assiciated with a block, including all inner blocks
Parameters:
replaceBlock [line 165]
boolean replaceBlock(
string
$block, string
$template, [boolean
$keep_content = false])
|
|
Replaces an existing block with new content. This function will replace a block of the template and all blocks contained in the replaced block and add a new block insted, means you can dynamically change your template. Note that changing the template structure violates one of the IT[X] development goals. I've tried to write a simple to use template engine supporting blocks. In contrast to other systems IT[X] analyses the way you've nested blocks and knows which block belongs into another block. The nesting information helps to make the API short and simple. Replacing blocks does not only mean that IT[X] has to update the nesting information (relatively time consumpting task) but you have to make sure that you do not get confused due to the template change itself.
Parameters:
replaceBlockfile [line 212]
void replaceBlockfile(
string
$block, string
$filename, [boolean
$keep_content = false])
|
|
Replaces an existing block with new content from a file.
Parameters:
setCallbackFunction [line 491]
boolean setCallbackFunction(
string
$tplfunction, string
$callbackfunction, [string
$callbackobject = ''])
|
|
Sets a callback function. IT[X] templates (note the X) can contain simple function calls. "function call" means that the editor of the template can add special placeholder to the template like 'func_h1("embedded in h1")'. IT[X] will grab this function calls and allow you to define a callback function for them. This is an absolutely evil feature. If your application makes heavy use of such callbacks and you're even implementing if-then etc. on the level of a template engine you're reiventing the wheel... - that's actually how PHP came into life. Anyway, sometimes it's handy. Consider also using XML/XSLT or native PHP. And please do not push IT[X] any further into this direction of adding logics to the template engine. For those of you ready for the X in IT[X]: <?php ... function h_one($args) { return sprintf('<h1>%s</h1>', $args[0]); } ... $itx = new HTML_Template_ITX( ... ); ... $itx->setCallbackFunction('h1', 'h_one'); $itx->performCallback(); ?> template: func_h1('H1 Headline');
Parameters:
setCallbackFuntiontable [line 519]
void setCallbackFuntiontable(
array
$functions)
|
|
Sets the Callback function lookup table
Parameters:
setFunctioncontent [line 442]
void setFunctioncontent(
int
$functionID, string
$replacement)
|
|
Replaces a function call with the given replacement.
Parameters:
updateBlockvariablelist [line 726]
void updateBlockvariablelist(
string
$block)
|
|
Updates the variable list of a block.
Parameters:
warning [line 789]
void warning(
string
$message, [string
$file = ''], [int
$line = 0])
|
|
Handles warnings, saves them to $warn and prints them or calls die() depending on the flags
Parameters:
Documentation generated on Mon, 11 Mar 2019 14:11:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|